

#https://www.chrome64bit.com/index.php/google-chrome-64-bit-for-linux
pacman -S --noconfirm chromium chromium-l10n chromium-shell chromium-driver chromium-widevine
#好用的浏览器
pacman -S --noconfirm qupzilla midori opera firefox

#kate: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
sudo strip --remove-section=.note.ABI-tag /usr/lib/libQt5Core.so.5

#Windows下安装VcXsrv
#https://sourceforge.net/projects/vcxsrv/

#WSL Ubuntu下安装xfce desktop
pacman -S --noconfirm xorg
pacman -S --noconfirm xorg-xinit xterm
pacman -S --noconfirm xfce4 xfce4-goodies xfce4-terminal

#windows命令运行
vcxsrv -ac

#~./bashrc末尾添加Display信息
export DISPLAY=$(ipconfig.exe | awk '/IPv4/ {sub("\r",":0"); print $NF;exit}')
export LIBGL_ALWAYS_INDIRECT=1

#显示中文
~/.bashrc
LANG=zh_CN.UTF-8

#好用的浏览器
qupzilla
midori
opera
firefox
chromium

grep "alias cls='clear'" ~/.bashrc > /dev/null
if [ $? -eq 0 ]; then
    echo "alias was seted."
else
cat >> ~/.bashrc <<-EOF
alias cls='clear'
alias pac='pacman'
alias paci='pacman -S --noconfirm'
alias pacs='pacman -Ss'
alias pacr='pacman -R --noconfirm'
alias vi='vim'
alias ls='ls --color=tty -hCF'
alias l='ls -al'
alias ll='ls -l'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
export PAGER=most
export BROWSER=firefox
export EDITOR=vim
export LANG=zh_CN.UTF-8
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mingw64/bin:/mingw64/sbin:~/bin:~/.local/bin:\$PATH
EOF
source ~/.bashrc
fi

#去掉数字签名，编辑安装目录下的etc/pacman.conf
SigLevel = Never

#archlinux错误：无法提交处理 (无效或已损坏的软件包)
#1.首先更新一下密钥，如果没有安装archlinux-keyring,请及时安装
#sudo pacman-key --refresh-keys

#2.重新加载相应的签名密钥
#sudo pacman-key --init
#sudo pacman-key --populate

#3.清除pacman 的缓冲文件
sudo pacman -Scc

#4.更新或者安装系统即可
sudo pacman -Syu

#查看工具套件
pacman -Sg

#colortool
pacman -S --noconfirm colortool
colortool -d solarized_dark.itermcolors

#python相关
pacman -S --noconfirm python2-pip python2-setuptools python-pip python-setuptools python-pytools

#pip配置
mkdir ~/.pip
touch ~/.pip/pip.conf
echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > ~/.pip/pip.conf
python -m pip install --upgrade pip

pip install cheat pip-tools ptpython

#语法检查
pip install --user flake8 pygments
#自动代码提示
pip install --user jedi
#自动导入模块
pip install --user isort
#代码格式化
pip install --user yapf

#安装nodejs
pacman -S --noconfirm nodejs npm
/usr/bin/npm config set registry https://registry.npm.taobao.org
/usr/bin/npm i -g tldr
#tldr --update
/usr/bin/npm i -g cnpm --registry=https://registry.npm.taobao.org
/usr/bin/npm i -g yarn --registry=https://registry.npm.taobao.org

#安装帮助手册
pacman -S --noconfirm help2man man-db man-pages man2html

#安装zsh和git
pacman -S --noconfirm zsh fish git

#常用工具
pacman -S --noconfirm net-tools sys-tools
pacman -S --noconfirm curl wget tree cscope gcc
pacman -S --noconfirm vim neovim vis nano gedit kate
pacman -S --noconfirm rust rustup go ruby jdk-openjdk

#space-vim
curl -sLf https://spacevim.org/cn/install.sh | bash

#fish config
grep "alias cls='clear'" ~/.config/fish/config.fish > /dev/null
if [ $? -eq 0 ]; then
    echo "alias was seted."
else
cat >> ~/.config/fish/config.fish <<-EOF
alias cls='clear'
alias pac='pacman'
alias paci='pacman -S --noconfirm'
alias pacs='pacman -Ss'
alias pacr='pacman -R --noconfirm'
alias vi='vim'
alias ls='ls --color=tty -hCF'
alias l='ls -al'
alias ll='ls -l'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
export PAGER=most
export BROWSER=firefox
export EDITOR=vim
export LANG=zh_CN.UTF-8
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mingw64/bin:/mingw64/sbin:~/bin:~/.local/bin:\$PATH
EOF
source ~/.config/fish/config.fish
fi

#zsh
pacman -S bat zsh zsh-autosuggestions autojump zsh-syntax-highlighting
#oh my zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
#手工安装autojump
cd ~/.oh-my-zsh/custom/plugins
git clone git://github.com/joelthelion/autojump.git
cd autojump
python3 install.py
#zsh plugins
git clone git://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/paulirish/git-open.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-open
#~/.zshrc
sed -i 's/plugins=(git)/plugins=(git git-open autojump zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrc
source ~/.zshrc

chsh -s /usr/bin/zsh

[ -e ~/.zshrc ] || sudo touch ~/.zshrc
#自定义别名
grep "alias cls='clear'" ~/.zshrc > /dev/null
if [ $? -eq 0 ]; then
    echo "alias was seted."
else
cat >> ~/.zshrc <<-EOF
alias cls='clear'
alias pac='pacman'
alias paci='pacman -S --noconfirm'
alias pacin='pacman -S --noconfirm'
alias pacs='pacman -Ss'
alias pacr='pacman -R --noconfirm'
alias vi='vim'
alias ls='ls --color=tty -hCF'
alias l='ls -al'
alias ll='ls -l'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
export PAGER=most
export BROWSER=firefox
export EDITOR=vim
export LANG=zh_CN.UTF-8
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mingw64/bin:/mingw64/sbin:~/bin:~/.local/bin:\$PATH
EOF
source ~/.zshrc
fi

#wsl-debian network config
sudo ifconfig eth0 netmask 255.255.255.240
sudo ip route add default via '192.168.235.129'